/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package MeshlessShapeFunctions;

/**
 *
 * @author mark
 */
public class JExponential implements IKernelFunction{

	protected double alpha;
	protected double rho;

    public JExponential(double alpha,double rho) {
        this.alpha = alpha;
        this.rho = rho;
    }

    public double evaluateNorm(double x, double y) {
        double xx = Math.sqrt(x*x + y*y);

        if( xx > 1.0 ){
            return 0.0;
        }else{
            return Math.exp(-xx/alpha*xx/alpha);
        }
    }

    public double evaluateSque(double x, double y) {
        return evaluateNorm(x, 0)*evaluateNorm(0, y);
    }

    public double evaluatePrimeNormX(double x, double y) {
        double xx = Math.sqrt(x*x + y*y);
        if( xx > 1.0 ){
            return 0.0;
        }else{
            return Math.exp(-xx/alpha*xx/alpha)*(-2 * xx/alpha/alpha);
        }
    }

    public double evaluatePrimeNormY(double x, double y) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public double evaluatePrimeSqueX(double x, double y) {
        return evaluatePrimeNormX(x, 0)*evaluatePrimeNormX(0, y);
    }

    public double evaluatePrimeSqueY(double x, double y) {
        return evaluatePrimeNormY(x, 0)*evaluatePrimeNormY(0, y);
    }

    public double evaluate(double x) {
        if( Math.abs(x) > 1.0 ){
            return 0.0;
        }else{
            return Math.exp(-x/alpha*x/alpha);
        }
    }

    public double evaluateDerivaty(double d) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

	@Override
	public double evaluateSecondDerivaty(double d) {
		// TODO Auto-generated method stub
		return 0;
	}

}
